<header id="topbar" class="affix" style="top:60px;">
    <link rel="stylesheet" type="text/css" href="../../css/withdraws.css">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/withdraw/">提现查询</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <!--<span class="text text-muted" id="selectTips">已选中0个</span>-->
        <!--<button class="btn btn-default btn-sm" id="paymentMethods">提现通道选择</button>-->
        <!--<button class="btn btn-default btn-sm" id="updateLimit">提现门槛设置</button>-->
        <!--<button class="btn btn-default btn-sm" id="checkSuccess">一键审核通过</button>-->
        <!--<button class="btn btn-default btn-sm" id="checkFail">一键审核失败</button>-->
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length > 0){ %>
    <div class="panel overflow">
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <!--<th class="text-center">-->
                        <!--<input type="checkbox" id="selectAll">-->
                    <!--</th>-->
                    <th>提现单号</th>
                    <th>用户ID</th>
                    <th class="sortable" data-field="price">提现金额</th>
                    <th data-field="real_price">到账金额</th>
                    <th>提现方式</th>
                    <th>提现通道</th>
                    <th>审核状态</th>
                    <th>提现状态</th>
                    <th>风控状态</th>
                    <th class="sortable" data-field="created_at">提现申请时间</th>
                    <th class="sortable" data-field="updated_at">最后更新时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){
                    var risk_info = item.withdraw_info.auto_risk || '';
                    if (item.withdraw_info.auto_trans_info) {
                        var trans_info = item.withdraw_info.auto_trans_info;
                        var exchange_chn = trans_info.payer_no;
                        if (exchange_chn == 'group_new_withdraw') {
                            exchange_chn = '万豪下分';
                        } else {
                            exchange_chn = '官方下分';
                        }
                    } else {
                        var exchange_chn = '-';
                    }
                    if(risk_info) risk_info = '(' + risk_info.length + '条)' + risk_info[0]
                    var check_status = WITHDRAW_CHECK_STATUS[item.check_status];
                    if (item.check_status == 0) {
                        if (item.status == 1) {
                            check_status = '等待系统审核';
                        } else {
                            check_status = '系统审核通过';
                        }
                    }
                %>
                    <tr data-uid="<%= item.uid %>" data-id="<%= item.id %>">
                        <!--<td class="text-center">-->
                            <!--<label class="option block mn">-->
                                <!--<input type="checkbox" value="FR" class="check-row">-->
                                <!--<span class="checkbox mn"></span>-->
                            <!--</label>-->
                        <!--</td>-->
                        <td><a class="modify-item"><%= item.id %></a></td>
                        <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.is_virtual ? '*' : '' %><%= item.user_id %></a></td>
                        <td><%= item.price %></td>
                        <td><%= item.real_price || '-'%></td>
                        <td><%= WITHDRAW_TYPE[item.target_type] %></td>
                        <td><%= exchange_chn %></td>
                        <td><%= check_status %></td>
                        <td><%= WITHDRAW_STATUS[item.status] %></td>
                        <td><%= risk_info %></td>
                        <td><%= item.created_at %></td>
                        <td><%= item.updated_at %></td>
                        <td>
                                <a class="glyphicons glyphicons-pencil modify-item" href="javascript:;"></a>
                        </td>
                    </tr>
                <%
                }) %>
            </tbody>
        </table>
    </div>
    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
    <% }else{ %>
    <h4 class="text-muted">请输入用户ID进行搜索</h4>
    <% } %>
</section>

<!-- Panel popup -->
<div id="editWithdrawPanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">提现详情</span>
        </div>
        <div class="panel-body">
            <form id="behavior-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label for="detailId" class="col-md-3 control-label">提现单号：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="detailId">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailUserId" class="col-md-3 control-label">用户编号：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="detailUserId">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailCashPrice" class="col-md-3 control-label">提现金额：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailCashPrice">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailCalCashPrice" class="col-md-3 control-label">需转账金额：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailCalCashPrice">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailType" class="col-md-3 control-label">提现方式：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailType">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailInfo" class="col-md-3 control-label">提现信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="otherInfo" class="col-md-3 control-label">交易信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="otherInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailCreatedAt" class="col-md-3 control-label">提现申请时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailCreatedAt">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="riskInfo" class="col-md-3 control-label">风控信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-danger" id="riskInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="operateInfo" class="col-md-3 control-label">操作信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-danger" id="operateInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailStatus" class="col-md-3 control-label">提现状态：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailStatus">
                  </p>
                </div>
            </div>
            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-primary" type="button" id="checkWithdraw">审核通过</button>
            <button class="btn btn-primary" type="button" id="uncheckWithdraw">审核拒绝</button>
            <button class="btn btn-primary" type="button" id="submitWithdraw">自动提现</button>
            <button class="btn btn-primary" type="button" id="finishWithdraw">完成提现</button>
            <button class="btn btn-primary" type="button" id="forbiddenWithdraw">禁止提现</button>
            <button class="btn btn-primary" type="button" id="backWithdraw">返款</button>
            <button class="btn btn-primary" type="button" id="submitClose">关闭</button>
        </div>
    </div>
</div>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano" style="top: 110px;">
    <div class="p20 admin-form">
        <h4 class="mt5 text-muted fw500">过滤条件：</h4>
        <hr class="short">
        <div class="section mb15">
            <label class="field prepend-icon">
                <input title="用户ID" type="text" id="searchUid" class="gui-input" data-field="user_id" placeholder="用户ID" value="<%= searched.user_id %>">
                <input title="ID" type="text" id="searchId" class="gui-input" data-field="id" placeholder="订单ID" value="<%= searched.id %>">
                <label class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <% var tf = searched.time_field || 'created_at',
            title = '申请时间(点击切换)';
            if(tf == 'updated_at')title = '提现时间(点击切换)';
        %>
        <h6 class="fw400" id="switchSearchTime" style="cursor: pointer"><%= title %></h6>
        <div class="section row" id="searchCreatedAt" <%= tf == 'created_at' ? '' : 'hidden' %>>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$gte" data-useless="" placeholder=">=" value="<%= searched.created_at ? searched.created_at.$gte : '' %>">
            </div>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$lte" data-useless="" placeholder="<=" value="<%= searched.created_at ? searched.created_at.$lte : '' %>">
            </div>
        </div>
        <div class="section row" id="searchUpdatedAt" <%= tf == 'updated_at' ? '' : 'hidden' %>>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="updated_at.$gte" data-useless="" placeholder=">=" value="<%= searched.updated_at ? searched.updated_at.$gte : '' %>">
            </div>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="updated_at.$lte" data-useless="" placeholder="<=" value="<%= searched.updated_at ? searched.updated_at.$lte : '' %>">
            </div>
        </div>
        <h6 class="fw400">提现方式</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchType" name="searchType" data-field="withdraw_type">
                    <option value="-1" <%= searched.withdraw_type == -1 ? 'selected' : '' %>>所有</option>
                    <option value="1" <%= searched.withdraw_type == 1 ? 'selected' : '' %>>支付宝</option>
                    <option value="0" <%= searched.withdraw_type == 0 ? 'selected' : '' %>>银行卡</option>
                    <option value="12" <%= searched.withdraw_type == 12 ? 'selected' : '' %>>qq钱包</option>
                    <option value="13" <%= searched.withdraw_type == 13 ? 'selected' : '' %>>微信</option>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400">提现状态</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchStatus" name="searchStatus" data-field="status">
                    <option value="-1" <%= searched.status == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(WITHDRAW_STATUS, function(v, k){ %>
                    <option value="<%= k %>" <%= searched.status == k ? 'selected' : '' %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400">审核状态</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchCheckStatus" name="searchCheckStatus" data-field="check_status">
                    <option value="-1" <%= searched.check_status == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(WITHDRAW_CHECK_STATUS, function(v, k){ %>
                    <option value="<%= k %>" <%= searched.check_status == k ? 'selected' : '' %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <hr class="short">

        <div class="row">
            <div class="col-md-6">
                <button class="btn btn-primary btn-block form-control" id="search">搜索</button>
            </div>
            <div class="col-md-6">
                <button class="btn btn-default btn-block form-control" id="export">导出</button>
            </div>
        </div>

    </div>
</aside>
<!-- End: Right Sidebar -->

<!-- 提现门槛设置框 start -->
<div id="withdrawLimitDialog" class="withdraw-limit-dialog" style="display:none">
    <div class="content">
        <span class="withdraw-limit">当前最低提现额:
            <span id="currentlimitCash" class="limit-cash">10</span>元
        </span>
        <div>
            <input id="newLimitCash" type="text" placeholder="请输入最低提限额">元
        </div>
        <div class="">
            <Button id="closeBtn" type="button" class="btn btn-danger">关闭</Button>
            <Button id="saveBtn" type="button" class="btn btn-success">确定</Button>
        </div>
    </div>
</div>
<!-- 提现门槛设置框 END -->

